package com.kaifamiao.thread.d0928.pm;

import java.io.FileOutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class UploadServer {

    public static void main(String[] args) throws Exception {
        ServerSocket server = new ServerSocket(9999);

        Socket accept = server.accept();

        System.out.println("已经建立连接： " + accept.getInetAddress());

        FileOutputStream out = new FileOutputStream("d:\\1.jpg");
        accept.getInputStream().transferTo(out);

        accept.getOutputStream().write("上传成功".getBytes());

        accept.shutdownOutput();
    }
}
